package ru.evga.inse.server.gwt.user.client.menu.admin;

import ru.evga.gwt.lib.common.client.place.PlaceImpl;
import ru.evga.gwt.lib.common.client.place.PlaceParamMap;
import ru.evga.inse.server.gwt.user.client.menu.MenuItem;
import ru.evga.inse.server.gwt.user.client.menu.MenuPlaceUtil;

public class AdminPlaceParamUtil
{
    
    public static final String KEY_ENTITY = "entity";

    public static Entities getEntity(PlaceParamMap paramMap)
    {
        String value = paramMap.get(KEY_ENTITY);
        return value == null ? null : Entities.valueOf(paramMap.get(KEY_ENTITY));
    }
    
    public static PlaceImpl.PlaceImplBuilder buildListEntityPlace(Entities entity)
    {
        return MenuPlaceUtil.getBuilderForMenu(MenuItem.ADMIN).add(KEY_ENTITY, entity.toString());
    }
}
